<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回受影响的记录数目</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.pg-affected-rows" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">pg_affected_rows</h1>
    <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pg_affected_rows</span> &mdash; <span class="dc-title">返回受影响的记录数目</span></p>

   </div>
   <div class="refsect1 unknown-seealsp" id="refsect1-function.pg-affected-rows-unknown-seealsp">
    <h3 class="title">说明</h3>
    <div class="methodsynopsis dc-description">
     <span class="methodname"><strong>pg_affected_rows</strong></span>
      ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result</code></span>
     ) : <span class="type">int</span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>pg_affected_rows()</strong></span> 返回在 <span class="function"><a href="pg_query.html" class="function">pg_query()</a></span>
     中执行 INSERT，UPDATE 和 DELETE
     查询后受到影响的记录数目（包括实例／记录／行）。如果本函数没有影响到任何记录，则返回 0。
    </p>
    <p class="para">
     <div class="example" id="example-2472">
      <p><strong>Example #1 <span class="function"><strong>pg_affected_rows()</strong></span> 例子</strong></p>
      <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"INSERT&nbsp;INTO&nbsp;authors&nbsp;VALUES&nbsp;('Orwell',&nbsp;2002,&nbsp;'Animal&nbsp;Farm')"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cmdtuples&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_affected_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$cmdtuples&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&nbsp;tuples&nbsp;are&nbsp;affected.\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
      </div>

     </div>
    </p>
    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <p class="para">
      本函数以前被称为 <em>pg_cmdtuples()</em>。
     </p>
    </p></blockquote>
    <p class="para">
     参见 <span class="function"><a href="pg_query.html" class="function">pg_query()</a></span> 和 <span class="function"><a href="pg_num_rows.html" class="function">pg_num_rows()</a></span>。
    </p>
   </div>

  </div></div></div></body></html>